﻿namespace KinonekoSoftware.CodariaDB.Documents.DataParts
{
    /// <summary>
    /// <see cref="Role"/> 类型用来表示一个带头衔的角色。
    /// </summary>
    public abstract class Role : ObservableObject
    {
        private string _name;
        private string _title;
        private string _intro;
        
        public string CharacterID { get; init; }

        [BsonIgnore]
        public InstanceCache Character { get; set; }
        
        [BsonIgnore]
        public bool HasTitle => !string.IsNullOrEmpty(Title);
        
        public string Intro
        {
            get => _intro;
            set => SetValue(ref _intro, value);
        }

        public string Title
        {
            get => _title;
            set
            {
                SetValue(ref _title, value);
                RaiseUpdated(nameof(HasTitle));
            }
        }

        public string Name
        {
            get => _name;
            set => SetValue(ref _name, value);
        }
    }
}